Skip to main content

Overview

As mentioned in the core concepts, Sentiment v2 has a layered lending approach, which separates external lending actions (super pool interactions) and internal lending actions (base pool interactions). The expected behavior is for ordinary users and developers to interact solely with super pools. While interaction with base pools is permitted, it is not expected that most users and developers will interact with base pools for lending activities.

Creating a Super Pool

Anyone can create and manage Super Pools on Sentiment v2. The aim is to make creation and maintenance of Super Pools as frictionless as possible.

Super Pools are deployed via a Super Pool Factory.

function deploySuperPool(
address owner,
address asset,
address feeRecipient,
uint256 fee,
uint256 superPoolCap,
uint256 initialDepositAmt,
string calldata name,
string calldata symbol
) external returns (address) { }

An overview of the Super Pool creation params:

  • owner The address of the Super Pool admin
  • asset The erc20 asset that the Super Pool accepts as deposits
  • feeRecipient The address to which fees generated from Super Pool will accrue to
  • fee The performance fee taken from interest accrued to the super pool, given to the feeRecipient
  • superPoolCap The maximum amount of assets that can be deposited in the SuperPool
  • initialDepositAmt Initial amount of assets, deposited into the superpool and burned
  • name name of super pool
  • symbol symbol of super pool. This will be used for LP tokens

Interacting with Super Pools

Admin functions

The creator of a Super Pool has privilege actions that help the admin manage assets, allocations and fees of a specific Super Pool.

Pool Management

Adding Pools

function addPool(uint256 poolId, uint256 assetCap) external onlyOwner{}
  • Adds a base pool to which assets can be allocated to
ParameterstypeDescription
poolIduintId of the pool to add
assetCapuintmaximum amount of assets to allocate

Removing Pools

function removePool(uint256 poolId, bool forceRemove) external onlyOwner{}
  • Removes a base pool
ParameterstypeDescription
poolIduintId of the pool to remove
forceRemoveboolif true, removes all the liquidity available from the base pool

Modify Pool Cap

function modifyPoolCap(uint256 poolId, uint256 assetCap) external onlyOwner 
  • modifies the allocation cap for a base pool
ParameterstypeDescription
poolIduintId of the pool to modify
assetCapuintamount to set pool cap to

Reallocation

 function reallocate(ReallocateParams[] calldata withdraws, ReallocateParams[] calldata deposits) external 
  • Reallocate assets between underlying pools
ParameterstypeDescription
withdrawscalldataA list of poolIds, and the amount to withdraw from them
depositscalldatalist of poolIds, and the amount to deposit to them

Lender Functions

Sentiment depositors can interact with Super Pools using functions for deposit and withdrawals. Super Pools are ERC4626 compliant, many of the utility functions should be familiar to most DeFi developers.

Deposit

function deposit(uint256 assets, address receiver) public nonReentrant returns (uint256 shares)
  • Allows a user to deposit assets in the Super Pool
ParameterstypeDescription
assetsuintThe amount of assets to deposit
receiveraddressThe address to receive the shares

Withdraw

function withdraw(uint256 assets, address receiver, address owner) public nonReentrant returns (uint256 shares)
  • Withdraw assets from Super Pool
ParameterstypeDescription
assetsuintThe amount of assets to withdraw
receiveraddressThe address to receive the assets
owneraddressThe address to withdraw the assets from

Redeem

function redeem(uint256 shares, address receiver, address owner) public nonReentrant returns (uint256 assets)
  • An alternative withdraw function that uses shares instead of asset amounts
    • This is good for accurate withdrawals. Since interest accrues per block, the regular withdrawal function is susceptible to leaving dust
ParameterstypeDescription
sharesuintThe amount of shares to redeem
receiveraddressThe address to receive the assets
owneraddressThe address to redeem the shares from